/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2023-5-10      ShiHao       first version
 */

#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>

#define DBG_TAG "main"
#define DBG_LVL         DBG_LOG
#include <rtdbg.h>

#define aht10_priority  25
#define wifi_priority 20
#define onenet_priority 25
#define matrix_priority 8

#include "wifi_task.c"
#include "ap3216_task.c"
#include "led_matrix_task.c"
#include "onenet_task.c"
#include "demo.h"

#define stacksize 1024
static rt_thread_t thread_init = RT_NULL;



int main(void)
{
    rt_mq_init(&mq,"mqt",&msg_pool[0],5*sizeof(float),sizeof(msg_pool),RT_IPC_FLAG_PRIO);
    rt_mq_init(&mq_led,"mqt_led",&msg_led[0],2*sizeof(float),sizeof(msg_led),RT_IPC_FLAG_PRIO);

    thread_init = rt_thread_create("ap3216c", ap3216c_entry, RT_NULL,stacksize, aht10_priority, 20);
    if(thread_init != RT_NULL)
        rt_thread_startup(thread_init);

    thread_init = rt_thread_create("wifi", wifi_entry, RT_NULL,1024, wifi_priority, 20);
    if(thread_init != RT_NULL)
    rt_thread_startup(thread_init);

    thread_init = rt_thread_create("onenet",onenet_entry,RT_NULL,2 * 1024,onenet_priority,20);
    if(thread_init != RT_NULL)
        rt_thread_startup(thread_init);

    thread_init = rt_thread_create("led matrix", led_matrix_entry, RT_NULL, 1024, matrix_priority, 50);
    if(thread_init != RT_NULL)
       rt_thread_startup(thread_init);



    return 0;

    return 0;
}

